package com.shanks.framework.mq.model;

import com.shanks.framework.mq.enums.MQZone;
import com.shanks.framework.mq.enums.MessageRecordStatusEnum;

import java.util.Date;
import java.util.Objects;

/**
 * 消息记录
 */
public class MessageRecordPO {
    private Long messageId;

    /**
     * 消息UUID,由messageJson + topic md5而成,数据库唯一索引防止重复推送
     */
    private String messageUuid;

    /**
     * 消息Json
     */
    private String messageJson;

    /**
     * 消息topic
     */
    private String messageTopic;

    /**
     * 消息tag
     */
    private String messageTag;

    /**
     * 消息状态
     */
    private MessageRecordStatusEnum messageRecordStatus;

    /**
     * 重试次数
     */
    private Integer retryCount;

    /**
     * 业务类型
     */
    private String bizType;

    /**
     * 业务uuid
     */
    private String bizUuid;

    /**
     * mq
     */
    private MQZone mqZone;

    /**
     * 生产者来源
     */
    private String producerSource;

    /**
     * 生产者key
     */
    private String producerKey;

    /**
     * 消费者来源
     */
    private String consumeSourece;

    /**
     * 发送中时间
     */
    private Date sendingTime;

    /**
     * 已发送时间
     */
    private Date sentTime;

    /**
     * ack时间
     */
    private Date ackTime;


    /**
     * 创建时间
     */
    private Date createTime;


    public Long getMessageId() {
        return messageId;
    }

    public void setMessageId(Long messageId) {
        this.messageId = messageId;
    }

    public String getMessageUuid() {
        return messageUuid;
    }

    public void setMessageUuid(String messageUuid) {
        this.messageUuid = messageUuid;
    }

    public String getMessageJson() {
        return messageJson;
    }

    public void setMessageJson(String messageJson) {
        this.messageJson = messageJson;
    }

    public String getMessageTopic() {
        return messageTopic;
    }

    public void setMessageTopic(String messageTopic) {
        this.messageTopic = messageTopic;
    }

    public String getMessageTag() {
        return messageTag;
    }

    public void setMessageTag(String messageTag) {
        this.messageTag = messageTag;
    }

    public MessageRecordStatusEnum getMessageRecordStatus() {
        return messageRecordStatus;
    }

    public void setMessageRecordStatus(MessageRecordStatusEnum messageRecordStatus) {
        this.messageRecordStatus = messageRecordStatus;
    }

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    public String getBizType() {
        return bizType;
    }

    public void setBizType(String bizType) {
        this.bizType = bizType;
    }

    public String getBizUuid() {
        return bizUuid;
    }

    public void setBizUuid(String bizUuid) {
        this.bizUuid = bizUuid;
    }

    public MQZone getMqZone() {
        return mqZone;
    }

    public void setMqZone(MQZone mqZone) {
        this.mqZone = mqZone;
    }

    public String getProducerSource() {
        return producerSource;
    }

    public void setProducerSource(String producerSource) {
        this.producerSource = producerSource;
    }

    public String getProducerKey() {
        return producerKey;
    }

    public void setProducerKey(String producerKey) {
        this.producerKey = producerKey;
    }

    public String getConsumeSourece() {
        return consumeSourece;
    }

    public void setConsumeSourece(String consumeSourece) {
        this.consumeSourece = consumeSourece;
    }

    public Date getSendingTime() {
        return sendingTime;
    }

    public void setSendingTime(Date sendingTime) {
        this.sendingTime = sendingTime;
    }

    public Date getSentTime() {
        return sentTime;
    }

    public void setSentTime(Date sentTime) {
        this.sentTime = sentTime;
    }

    public Date getAckTime() {
        return ackTime;
    }

    public void setAckTime(Date ackTime) {
        this.ackTime = ackTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof MessageRecordPO))
            return false;
        MessageRecordPO record = (MessageRecordPO) o;
        return (Objects.equals(getMessageId(), record.getMessageId()) && Objects.equals(getMessageUuid(), record.getMessageUuid()) && Objects.equals(getMessageJson(), record.getMessageJson()) && Objects.equals(getCreateTime(), record.getCreateTime()) && Objects.equals(getSendingTime(), record.getSendingTime()) && Objects.equals(getSentTime(), record.getSentTime()) && Objects.equals(getAckTime(), record.getAckTime()) && Objects.equals(getRetryCount(), record.getRetryCount()) && getMessageRecordStatus() == record.getMessageRecordStatus() && Objects.equals(getMessageTag(), record.getMessageTag()) && Objects.equals(getMessageTopic(), record.getMessageTopic()) && Objects.equals(getBizUuid(), record.getBizUuid()) && Objects.equals(getBizType(), record.getBizType()) && Objects.equals(getProducerKey(), record.getProducerKey()) && Objects.equals(getProducerSource(), record.getProducerSource()) && Objects.equals(getConsumeSourece(), record.getConsumeSourece()) && Objects.equals(getMqZone(), record.getMqZone()));
    }

    public int hashCode() {
        return Objects.hash(new Object[]{
                getMessageId(), getMessageUuid(), getMessageJson(), getCreateTime(), getSendingTime(), getSentTime(), getAckTime(), getRetryCount(), getMessageRecordStatus(), getMessageTag(),
                getMessageTopic(), getBizUuid(), getBizType(), getProducerKey(), getProducerSource(), getConsumeSourece(), getMqZone()});
    }
}
